package org.example.facade.component;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.example.physics_engine.body.PhysicsBody;
import org.example.physics_engine.geometry.Vector2d;
import org.example.facade.panel.DefaultPanelRenderer;
import org.example.facade.panel.PanelRenderer;
import org.example.facade.panel.SVGRenderer;

import java.util.function.Function;

@Getter
@AllArgsConstructor
public enum Component_Type {
    BALL("gizmo/ball", Component_Draggable.ballBodyCreator, new SVGRenderer("icons/earth.svg")),

    CIRCLE("gizmo/circle", Component_Draggable.circleBodyCreator, new SVGRenderer("icons/circle1.svg")),

    HOLE("gizmo/blackHole", Component_Draggable.blackHoleBodyCreator, new SVGRenderer("icons/blackhole.svg")),

    RECTANGLE("gizmo/rectangle", Component_Draggable.rectangleBodyCreator, new SVGRenderer("icons/recentangle1.svg")),

    TRIANGLE("gizmo/triangle", Component_Draggable.triangleBodyCreator, DefaultPanelRenderer.INSTANCE),

    ORBIT("gizmo/pipe", Component_Draggable.pipeBodyCreator, new SVGRenderer("icons/orbit.svg")),

    CURVED_ORBIT("gizmo/curvedPipe", Component_Draggable.curvedPipeBodyCreator, new SVGRenderer("icons/orbit_curved.svg")),

    LEFT_BARRIER("gizmo/leftFlipper", Component_Draggable.leftFlipperBodyCreator, DefaultPanelRenderer.INSTANCE),

    RIGHT_BARRIER("gizmo/rightFlipper", Component_Draggable.rightFlipperBodyCreator, DefaultPanelRenderer.INSTANCE),

    BOUNDARY("gizmo/boundary", null, PanelRenderer.DO_NOT_RENDER);

    private final String id;

    private final Function<Vector2d, ? extends PhysicsBody> physicsBodySupplier;

    private final PanelRenderer panelRenderer;

    public PanelRenderer getPanelRenderer() {
        return panelRenderer;
    }

    @Override
    public String toString() {
        return id;
    }
}
